package com.atguigu.gulimall.product.entity;

import com.atguigu.common.valid.AddGroup;
import com.atguigu.common.valid.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.*;

/**
 * 品牌
 * @author liuyong
 * @email sunlightcs@gmail.com
 * @date 2020-07-06 14:12:57
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@Null(message = "新增时不能添加ID", groups = {AddGroup.class})
	@NotNull(message ="修改时必须添加ID",groups = {UpdateGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空")
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "品牌logo地址必须是一个合法的URL地址",groups = {UpdateGroup.class,AddGroup.class})
	@NotBlank(message = "品牌logo地址不能为空")
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank(message = "介绍信息不能为空")
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@Min(value = 0,message = "显示状态只能为1或者0")
	@Max(value = 1,message = "显示状态只能为1或者0")
	@NotNull(message = "显示状态不能为空")
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空")
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序数字必须大于等于0")
	private Integer sort;

}
